package com.cefa.finance.result;

public class ResultModel {
    private Integer code;
    private String message;
    private Object content;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getContent() {
        return content;
    }

    public void setContent(Object content) {
        this.content = content;
    }

    public ResultModel(Integer code, String message) {
        this.code = code;
        this.message = message;
        this.content = "";
    }

    public ResultModel(Integer code, String message, Object content) {
        this.code = code;
        this.message = message;
        this.content = content;
    }

    public ResultModel(ResultStatus status) {
        this(status.getCode(),status.getMessage());
    }

    public ResultModel(ResultStatus status, Object object) {
        this(status.getCode(), status.getMessage(), object);
    }

    public static ResultModel OK() {
        return new ResultModel(ResultStatus.SUCCESS);
    }

    public static ResultModel OK(Object object) {
        return new ResultModel(ResultStatus.SUCCESS, object);
    }

    public static ResultModel ERROR() {
        return new ResultModel(ResultStatus.FAILED);
    }

    public static ResultModel ERROR(Object object) {
        return new ResultModel(ResultStatus.FAILED, object);
    }

    public static ResultModel ERROR(ResultStatus error) {
        return new ResultModel(error);
    }
}
